Skip to content

Fix sock_connect using wrong rights constant#4849

Merged
lum1n0us merged 1 commit intobytecodealliance:mainfrom
sumleo:fix/sock-connect-rights-check
Feb 27, 2026
Merged

Fix sock_connect using wrong rights constant#4849
lum1n0us merged 1 commit intobytecodealliance:mainfrom
sumleo:fix/sock-connect-rights-check

Conversation

@sumleo
Copy link
Contributor

@sumleo sumleo commented Feb 25, 2026

Summary

wasi_ssp_sock_connect in posix.c checks __WASI_RIGHT_SOCK_BIND instead of __WASI_RIGHT_SOCK_CONNECT when validating file descriptor rights via fd_object_get. This was a copy-paste error from the adjacent wasi_ssp_sock_bind function.

As a result, sock_connect operations validate the wrong capability on the file descriptor — checking for bind rights rather than connect rights.

Fix

Changed the rights constant from __WASI_RIGHT_SOCK_BIND to __WASI_RIGHT_SOCK_CONNECT in the fd_object_get call within wasi_ssp_sock_connect.

Test plan

  • Verified that the wasi_ssp_sock_bind function still correctly uses __WASI_RIGHT_SOCK_BIND
  • Verified that only the single occurrence in wasi_ssp_sock_connect was changed
  • Existing socket test cases should continue to pass

wasi_ssp_sock_connect checks __WASI_RIGHT_SOCK_BIND instead of
__WASI_RIGHT_SOCK_CONNECT when validating file descriptor rights.
This was a copy-paste error from wasi_ssp_sock_bind. As a result,
connect operations check the wrong capability.
@lum1n0us lum1n0us merged commit 6a504e5 into bytecodealliance:main Feb 27, 2026
504 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants